/*-------------------------------------------------------------------------

***************** Modification History ***********************************
   @doc
   @module mem.c - Memory manipulation functions |
   @end

$Log: /SoftPay/SPK2SIM/Source/Utils/mem.c $
**************************************************************************

   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.

---------------------------------------------------------------------------*/
#include <project.h>
#define VSMEM_C

#include <stdlib.h>

/** /#define DEBUG_VSMEM*/
#ifdef DEBUG_VSMEM
#define DEBUG_95
#endif

#include <define.h>
#include <mem.h>
#include <spdebug.h>
#include <pfr.h>

static int siMemUsage = 0;

char* pchAlloc(unsigned unSize) {
    char* ptr;

    /** /pdebug(("--pchAlloc--"));*/
    /** /pdebug(("pchalloc unSize = %u", unSize));*/



    ptr = calloc(1, unSize);

    /**/pdebug(("pchAlloc = %lX (%u)", ptr, unSize));/**/
    ++siMemUsage;



    return(ptr);
}

void vdFree(char* ptr) {
    /** /pdebug(("--vdFree--"));*/
    /**/pdebug(("vdFree   = %lX (%d)", ptr, siMemUsage));/**/

    if (ptr) {
        --siMemUsage;
        free(ptr);
    }
}

#undef VSMEM_C

